#include <catch2/catch.hpp>

#include <unordered_set>

#include "solution.hpp"

using namespace solution_017;

TEST_CASE("17. Letter Combinations of a Phone Number", "[017]") {

SECTION("example 1") {
    auto ans = Solution().letterCombinations("29");
    CHECK(ans.size() == 12);
    CHECK(std::unordered_set(ans.crbegin(), ans.crend()) ==
            std::unordered_set<std::string>
            {"aw","ax","ay","az","bw","bx","by","bz","cw","cx","cy","cz"});
}

SECTION("example 2") {
    auto ans = Solution().letterCombinations("23");
    CHECK(ans.size() == 9);
    CHECK(std::unordered_set(ans.crbegin(), ans.crend()) ==
            std::unordered_set<std::string>
            {"ad","ae","af","bd","be","bf","cd","ce","cf"});
}

SECTION("example 3") {
    CHECK(Solution().letterCombinations("").empty());
}

}
